#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Created: Tue May 18 22:03:57 2010

from sys import argv
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class FrameInformation(QFrame):
    def __init__(self, connection, parent = None):
        super(FrameInformation, self).__init__(parent)

        self.connection = connection
        self.LCPinformation = self.connection.root.Modules.system_info.SystemInfo()

        hostName = self.LCPinformation.gethostName()
        osName = self.LCPinformation.getOS()
        time = self.LCPinformation.getTime_Date()
        kernelVersion = self.LCPinformation.getKernV_processorArc()
        uptime = self.LCPinformation.getSys_uptime()
        loadAverage = self.LCPinformation.CPULoadAverages()
        memoryUsage = self.LCPinformation.realMemInfo()

        self.resize(819, 580)

        self.lbl_Logo = QLabel()
        self.lbl_Logo.setPixmap(QPixmap('icons/logos/logo3.png'))
        self.lbl_Logo.setAlignment(Qt.AlignHCenter)

        self.lbl_HostName = QLabel('<b> Host Name: <font color=green>' + hostName + '</font>')
        self.lbl_HostName.setAlignment(Qt.AlignHCenter)

        self.lbl_OS = QLabel('<b> Operating System: <font color=green>' + osName + '</font>')
        self.lbl_OS.setAlignment(Qt.AlignHCenter)

        self.lbl_Time = QLabel('<b> System Time: <font color=green>' + time + '</font>')
        self.lbl_Time.setAlignment(Qt.AlignHCenter)

        self.lbl_Kernel = QLabel('<b> Kernel Version: <font color=green>' + kernelVersion + '</font>')
        self.lbl_Kernel.setAlignment(Qt.AlignHCenter)

        self.lbl_UpTime = QLabel('<b> System Uptime: <font color=green>' + uptime + '</font>')
        self.lbl_UpTime.setAlignment(Qt.AlignHCenter)

        self.lbl_Load = QLabel('<b> Load Average: <font color=green>' + loadAverage + '</font>')
        self.lbl_Load.setAlignment(Qt.AlignHCenter)

        self.lbl_Memory = QLabel('<b> Memory Usage: <font color=green>' + memoryUsage + '</font>')
        self.lbl_Memory.setAlignment(Qt.AlignHCenter)

        self.vlayout = QVBoxLayout()
        self.vlayout.addWidget(self.lbl_Logo)
        self.vlayout.addWidget(self.lbl_HostName)
        self.vlayout.addWidget(self.lbl_OS)
        self.vlayout.addWidget(self.lbl_Time)
        self.vlayout.addWidget(self.lbl_Kernel)
        self.vlayout.addWidget(self.lbl_UpTime)
        self.vlayout.addWidget(self.lbl_Load)
        self.vlayout.addWidget(self.lbl_Memory)

        self.setLayout(self.vlayout)


if __name__ == '__main__':
    app = QApplication(argv)
    abstract_window = FrameInformation(None)
    abstract_window.show()
    app.exec_()
